package com.weibo4j.api.req.favourite;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import com.weibo4j.api.WeiboRequest;
import com.weibo4j.api.response.favourite.TagGetResponse;
import com.weibo4j.api.util.RequestType;

public class TagUpdateRequest extends WeiboRequest<TagGetResponse>{
    
    private Long tid;
    
    private String tag;
    
    public Long getTid() {
        return tid;
    }

    public void setTid(Long tid) {
        this.tid = tid;
    }

    public String getTag() {
        if (tag != null) {
            try {
                return URLEncoder.encode(tag, "utf-8");
            } catch (UnsupportedEncodingException e) {
            }
        }
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    @Override
    public RequestType requestType() {
        return RequestType.POST;
    }

    @Override
    public String baseUrl() {
        return "https://api.weibo.com/2/favorites/tags/update_batch.json";
    }

    @Override
    protected Class<TagGetResponse> responseType() {
        return TagGetResponse.class;
    }

}
